package com.study.d7_otherstream;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

public class ObjectDemo {
    public static void main(String[] args) throws Exception {
        Student s1 = new Student("哪吒",20,"12345678",178.5);
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("day10/src/obj.txt"));
        oos.writeObject(s1);
        oos.close();
        //如果一次性序列化多个对象，应该用ArrayList集合存储多个对象，然后直接对集合进行序列号即可
        //注意：ArrayList已经实现序列化接口
    }
}
